package com.he.architecture.Enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum CustomerOrderTypeEnums {
    NOT_PAYED(1), // 未支付
    PAYED(2), // 已支付
    REFUNDED(3),  // 已退款
    CONFIRM(4), //已经确认
    CANCEL(5);//取消




    private final int code;
    //根据code值获取用户的状态
    public static CustomerOrderTypeEnums valueOf(int code){
        //遍历状态
        for(CustomerOrderTypeEnums states:values()){
            if(states.getCode()==code){
                return states;
            }
        }
        throw new IllegalArgumentException("Invalid User Status code: " + code);
    }
}
